import grpc
import greeter_pb2
import greeter_pb2_grpc

def run():
    # 连接 gRPC 服务器
    with grpc.insecure_channel('localhost:5555') as channel:
        stub = greeter_pb2_grpc.GreeterStub(channel)
        
        # 创建请求
        request = greeter_pb2.Request(name='yangxianpku', age=12)
        
        # 调用远程方法
        response = stub.sayHello(request, None)
        print(response.message)

if __name__ == '__main__':
    run()